package com.itheima.stream;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class StreamDemo04 {
    public static void main(String[] args) {
        //单列集合
        ArrayList<Integer> arrayList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            arrayList.add(i);
        }
        arrayList.add(10);
        arrayList.add(10);

        List<Integer> list = arrayList.stream().filter(number -> number % 2 == 0)
                .collect(Collectors.toList());
        System.out.println(list);
        System.out.println("=============");

        Set<Integer> set = arrayList.stream().filter(number -> number % 2 == 0)
                .collect(Collectors.toSet());
        System.out.println(set);




    }
}
